<!--  -->
<template>
<div class="app-home">
    <aabb></aabb>
    <h1>数据统计</h1>
    <div class="app-home-container">
      <div class="home-container-box">
        <div class="container-box-left">
          <span class="title">总用户量:</span>
          <span class="num">{{ a1 }}</span>
        </div>
        <div class="container-box-right">
          <span class="title1">注册用户:</span>
          <span class="num1">{{ a2 }}</span>
        </div>
      </div>
      <div class="home-container-box">
        <div class="container-box-left">
          <span class="title">总订单量:</span>
          <span class="num">{{ a3 }}</span>
        </div>
        <div class="container-box-right">
          <span class="title1">新增订单:</span>
          <span class="num1">{{ a4 }}</span>
        </div>
      </div>
      <div class="home-container-box">
        <div class="container-box-left">
          <span class="title">管理员:</span>
          <span class="num">{{ a5 }}</span>
        </div>
        <div class="container-box-right">
          <span class="title1">新增管理员:</span>
          <span class="num1">{{ a6 }}</span>
        </div>
      </div>
    </div>
    <div class="app-home-chart">
        <!-- 
            todo:
            1. servernDate 日期的数据 ["2020-10-20",.....,"2020-10-26"]
            2.servernDayData [[1,2,3,4,5,6,7],[1,2,3,4,5,6,7],[1,2,3,4,5,6,7]]
            // servernDayData[0] 新增用户
            // servernDayData[1] 新增订单
            // servernDayData[2] 新增管理员
         -->
        <tendency></tendency>
    </div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import Tendency from "@/components/charts/tendency.vue"
import abc from '@/views/mianbao.vue'
import  {getTotalUser,getUserCount,getdd,getjtdd,getgly,getjtjtdd}  from '@/myaxios/api.js'
import {DateUtils} from '@/myaxios/utils.js'
export default {
//import引入的组件需要注入到对象中才能使用
components: {
    'aabb':abc,
    "tendency":Tendency
},
data() {
//这里存放数据
return {
    a1:'',
    a2:'',
    a3:'',
    a4:'',
    a5:'',
    a6:'',
};
},
//监听属性 类似于data概念
computed: {},
//监控data中的数据变化
watch: {},
//方法集合
methods: {

},
//生命周期 - 创建完成（可以访问当前this实例）
created() {

},
//生命周期 - 挂载完成（可以访问DOM元素）
mounted() {
    let today = DateUtils.getFormatDate(new Date())
    Promise.all([getTotalUser(),getUserCount(today),getdd(),getjtdd(today),getgly(),getjtjtdd(today)]).then(res=>{
        console.log(res);
        this.a1=res[0].count
        this.a2=res[1].count
        this.a3=res[2].count
        this.a4=res[3].count
        this.a5=res[4].count
        this.a6=res[5].count
    })

},
beforeCreate() {}, //生命周期 - 创建之前
beforeMount() {}, //生命周期 - 挂载之前
beforeUpdate() {}, //生命周期 - 更新之前
updated() {}, //生命周期 - 更新之后
beforeDestroy() {}, //生命周期 - 销毁之前
destroyed() {}, //生命周期 - 销毁完成
activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang='less' scoped>
@import url("../style/mixin.less");
.app-home {
  background-color: white;
  height: 100%;
  width: 100%;
  h1 {
    text-align: center;
    font-weight: 300;
    height: 50px;
    line-height: 50px;
    margin-top: 30px;
  }
  .app-home-container {
    display: flex;
    margin: 40px 0;
    .home-container-box {
      height: 80px;
      border-top: 1px solid #ddd;
      border-right: 1px solid #ddd;
      border-bottom: 1px solid #ddd;
      flex: 1;
      display: flex;
      .container-box-left {
        .fc();
        flex: 1;
        .num {
          font-size: 30px;
          font-weight: 200;
          color: #ff9800;
        }

        .title {
        }
      }

      .container-box-right {
        .fc();
        flex: 1;
        .title1 {
        }

        .num1 {
          font-size: 30px;
          font-weight: 200;
          color: #20a0ff;
        }
      }
    }
  }
}
</style>